package cn.tedu.spring.bean;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class TestUserDao {
    public static void main(String[] args) {
        /**
         * 1.创建spring bean对象----IOC容器
         * 2.获取spring bean对象--- getbean(类,class)
         * 3.使用spring bean对象
         */
//        ApplicationContext context=new AnnotationConfigApplicationContext("cn.tedu.spring.bean");
//        UserDao userDao = context.getBean(UserDao.class);
//        System.out.println("userDao = " +userDao);

        ApplicationContext context1=new AnnotationConfigApplicationContext("cn.tedu.spring.bean");
        UserService userService = context1.getBean(UserService.class);
        System.out.println("userService = " +userService);
    }
}
